# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=arm-- -run-pass=machine-outliner -verify-machineinstrs \
# RUN: %s -o - | FileCheck %s

--- |
  define void @outline_no_save_ok_arm() #0 { ret void }
  define void @outline_no_save_ok_thumb() #1 { ret void }

  declare void @foo()

  attributes #0 = { minsize optsize }
  attributes #1 = { minsize optsize "target-features"="+armv7-a,+thumb-mode" }
...
---

name:           outline_no_save_ok_arm
tracksRegLiveness: true
body:             |
  ; CHECK-LABEL: name: outline_no_save_ok_arm
  ; CHECK: bb.0:
  ; CHECK:   BL @OUTLINED_FUNCTION_1
  ; CHECK: bb.1:
  ; CHECK:   BL @OUTLINED_FUNCTION_1
  ; CHECK: bb.2:
  ; CHECK:   BX_RET 14 /* CC::al */, $noreg
  bb.0:
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r3 = LDRi12 $sp, 8, 14, $noreg
  bb.1:
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r2 = MOVi 1, 14, $noreg, $noreg
    $r3 = LDRi12 $sp, 8, 14, $noreg
  bb.2:
    BX_RET 14, $noreg
...
---

name:           outline_no_save_ok_thumb
tracksRegLiveness: true
body:             |
  ; CHECK-LABEL: name: outline_no_save_ok_thumb
  ; CHECK: bb.0:
  ; CHECK:   tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0
  ; CHECK: bb.1:
  ; CHECK:   tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_0
  ; CHECK: bb.2:
  ; CHECK:   tBX_RET 14 /* CC::al */, $noreg
  bb.0:
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    t2STRi12 $r2, $sp, 0, 14, $noreg
  bb.1:
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    $r2 = t2MOVi 1, 14, $noreg, $noreg
    t2STRi12 $r2, $sp, 0, 14, $noreg
  bb.2:
    tBX_RET 14, $noreg

  ; CHECK-LABEL: name: OUTLINED_FUNCTION_0
  ; CHECK: bb.0:
  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   t2STRi12 $r2, $sp, 0, 14 /* CC::al */, $noreg
  ; CHECK:   tBX_RET 14 /* CC::al */, $noreg

  ; CHECK-LABEL: name: OUTLINED_FUNCTION_1
  ; CHECK: bb.0:
  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
  ; CHECK:   $r3 = LDRi12 $sp, 8, 14 /* CC::al */, $noreg
  ; CHECK:   MOVPCLR 14 /* CC::al */, $noreg
